<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="../../layuiadmin/layui/css/layui.css"
	media="all">
<link rel="stylesheet" href="../../layuiadmin/style/admin.css"
	media="all">

</head>
<body>
	<!-- 主页面开始 -->
	<div class="layui-fluid" id="LAY-component-grid-list">
		<!-- 查询开始 -->
		<div class="layui-row layui-col-space10 demo-list">
			<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
				<div class="layui-card">
					<div class="layui-card-header">查询</div>
					<div class="layui-card-body" id="search-view">
						<form class="layui-form" action="" id="searchForm">
							<div class="layui-form-item">
								<div class="layui-inline">
									<label class="layui-form-label">科室</label>
									<div class="layui-input-inline">
										<input type="text" name="officeName" autocomplete="off"
											class="layui-input">
									</div>
								</div>
							</div>
							<div class="layui-inline">
								<label class="layui-form-label"></label>
								<div class="layui-input-inline">
									<button type="submit"
										class="layui-btn layui-icon layui-icon-search" lay-submit=""
										lay-filter="search">查询</button>
									<button type="reset"
										class="layui-btn layui-btn-warm layui-icon layui-icon-refresh">重置</button>
								</div>
							</div>
						</form>
					</div>
				</div>
			</div>
		</div>
		<!-- 查询结束 -->
		<!-- 表格开始 -->
		<div class="layui-row layui-col-space10 demo-list">
			<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
				<div class="layui-card">
					<div class="layui-card-header">科室信息</div>
					<div class="layui-card-body">
						<table class="layui-table" id="office-table"
							lay-filter="dataTable" lay-skin="line" style="text-align: center">

						</table>
					</div>
				</div>
			</div>
		</div>
		<!-- 表格结束 -->
	</div>
	<!-- 主页面结束 -->

	<!-- 表格工具条开始 -->
	<div id="table-toolbar" style="display: none" lay-filter="tableToolbar">
		<button type="submit" class="layui-btn layui-icon layui-icon-add-1"
			lay-event="add">添加</button>
		<button type="reset" class="layui-btn layui-btn-primary"
			lay-event="batchDelete">批量删除</button>
	</div>
	<!-- 表格工具条结束 -->
	<!-- 行工具开始 -->
	<script type="text/html" id="row-bar">
		<a class="layui-btn layui-btn-xs layui-icon layui-icon-edit" lay-event="edit">编辑</a>
		<a class="layui-btn layui-btn-xs layui-icon layui-icon-edit" lay-event="delete">删除</a>
	</script>
	<!-- 行工具结束 -->
	
	
	
	<script src="../../layuiadmin/layui/layui.js"></script>
	<script>
		layui.config({
			base : '../../../layuiadmin/' //静态资源所在路径
		}).extend({
			index : 'lib/index' //主入口模块
		}).use(
				[ "table", "jquery", "form", "layer", "element", "laypage",
						"laydate" ], function() {
					var laytpl = layui.laytpl;
					var $ = layui.$;
					var form = layui.form;
					var element = layui.element;
					var laypage = layui.laypage;
					var table = layui.table;
					var layer = layui.layer;
					var laydate = layui.laydate;

					var tableIns;
					// 表格渲染
					tableIns = table.render({
						elem : "#office-table",
						url : "/office/findOffices",
						method : "post",
						defaultToolbar : [],
						toolbar : "#table-toolbar",
						page : true,
						even : true,
						limit : 5,
						cols : [ [ {
							type : "checkbox",
							fixed : "left"
						}, {
							type : "numbers",
							title : "序号",
							width : 120
						}, {
							field : "officeId",
							title : "科室编号",
							width : 120
						}, {
							field : "officeName",
							title : "科室名称",
							width : 120
						}, , {
							toolbar : "#row-bar",
							title : '操作',
							width : 300
						} ] ],
						parseData : function(res) {
							console.log('获取所有的数据', res)
							return {
								"code" : res.code == 200 ? 0 : res.code,
								"msg" : res.msg,
								"count" : res.count,
								"data" : res.data
							}
						}
					});
				});
	</script>
</body>
</html>